<template>
  <el-dialog title="详情"
             :close-on-click-modal="false" append-to-body
             :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
             width="600px">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right">
        <template v-if="!loading">
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="卡片容器">
              <el-col :span="8">
                <el-form-item label="处置标题"
                              prop="disposalTitle">
                  <p>{{ dataForm.disposalTitle }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="处置方式"
                              prop="disposalType">
                  <p>{{ dataForm.disposalType }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="开始日期"
                              prop="startDate">
                  <p>{{ jnpf.toDate(dataForm.startDate, "yyyy-MM-dd") }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="经办人"
                              prop="disposalAgent">
                  <p>{{ dataForm.disposalAgent }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="处置单位"
                              prop="disposalUnit">
                  <p>{{ dataForm.disposalUnit }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="处置说明"
                              prop="disposalSpecification">
                  <p>{{ dataForm.disposalSpecification }}</p>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="卡片容器">
              <el-col :span="24">
                <el-form-item label-width="0">
                  <div class="JNPF-common-title">
                    <h2>设计子表</h2>
                  </div>
                  <el-table :data="dataForm.zcassetdisposedetailsList" size='mini'>
                    <el-table-column type="index" width="50" label="序号" align="center"/>
                    <el-table-column prop="assetId" label="资产信息">
                      <template slot-scope="scope">
                        <p>{{ scope.row.assetId }}</p>
                      </template>
                    </el-table-column>
                    <el-table-column prop="creatoruserid" label="创建人">
                      <template slot-scope="scope">
                        <p>{{ scope.row.creatoruserid }}</p>
                      </template>
                    </el-table-column>
                  </el-table>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import request from '@/utils/request'
import PrintBrowse from '@/components/PrintBrowse'
import jnpf from '@/utils/jnpf'

export default {
  components: {PrintBrowse},
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: '',
      dataForm: {
        id: '',
        disposalTitle: '',
        disposalType: "",
        startDate: '',
        disposalAgent: '',
        disposalUnit: "",
        disposalSpecification: '',
        zcassetdisposedetailsList: [],
      },

    }
  },
  computed: {},
  watch: {},
  created() {

  },
  mounted() {
  },
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll
      for (let i = 0; i < _dataAll.zcassetdisposedetailsList.length; i++) {
        var _list = _dataAll.zcassetdisposedetailsList[i];
      }
      this.dataForm = _dataAll
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/zc/ZcAssetDispose/detail/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          })
        }

      })
    },
  },
}

</script>
